home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr11 / pdox693.zip / TI1213.ASC < prev    next >
Text File  |  1993-01-14  |  5KB  |  199 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8. PRODUCT  :  Paradox                               NUMBER  :  1213
  9. VERSION  :  All
  10.      OS  :  DOS
  11.    DATE  :  January 14, 1993                         PAGE  :  1/3
  12.  
  13.   TITLE  :  Generating Incremental Values Using SETKEY
  14.  
  15.  
  16.  
  17.  
  18. This Technical Information Sheet illustrates how to generate
  19. incremental values by using a SETKEY macro.  The following one
  20. line PAL script takes the maximum numeric value from the field
  21. named "fieldname" , increments it by one, and assigns the new
  22. value to the field named "fieldname".  The PAL commands and
  23. functions that are featured in the script are the SETKEY command
  24. and the CMAX() function.
  25.  
  26. Note:  The SETKEY macro presented in this Technical Information
  27. Sheet is intended for a single user working in interactive mode.
  28. It is not intended to be used in a network environment.  For
  29. information on generating incremental values in a in a PAL
  30. application or in a network environment, refer to TI 662.
  31.  
  32. The PAL code in the script below should be placed in an Init
  33. script in the private directory.  If you aren't using a private
  34. directory, then the Init script should be in the directory where
  35. Paradox was installed, for example PDOX40.  The Init script is a
  36. Paradox program that runs automatically when Paradox is started
  37. like an Autoexec.bat file runs automatically when a computer is
  38. booted.
  39.  
  40. To create the script:
  41.  
  42.    1.  The following instructions assume that you do not have an
  43.        existing Init script.  If you do have an existing Init
  44.        script, skip to number 4 on the next page.  Change your
  45.        working directory to your private directory.  From the
  46.        Paradox Menu, select Tools | More | Directory , then type
  47.        in the path name of your private directory (if you don't
  48.        have a private directory this should be the directory
  49.        where Paradox is installed, i.e. C:\PDOX40).
  50.  
  51.    2.  From the Paradox Menu, select Scripts | Editor | New
  52.        (for versions earlier than 4.0, select Scripts | Editor |
  53.        Write).
  54.  
  55.    3.  At the prompt, type "Init" as the name of your script
  56.        (don't type it in quotes).  If Paradox prompts you with
  57.        the message "Scriptname file already exists" and gives you
  58.        the option of Cancel | Replace, select Cancel, then skip
  59.        to number 4 on the next page, otherwise skip to number 5.
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74. PRODUCT  :  Paradox                               NUMBER  :  1213
  75. VERSION  :  All
  76.      OS  :  DOS
  77.    DATE  :  January 14, 1993                         PAGE  :  2/3
  78.  
  79.   TITLE  :  Generating Incremental Values Using SETKEY
  80.  
  81.  
  82.  
  83.  
  84.    4.  If you have an existing Init script, edit the Init script
  85.        by selecting Scripts | Editor | Open (for versions earlier
  86.        than 4.0, select Scripts | Editor | Edit), type "Init" for
  87.        the script name (don't type it in quotes).
  88.  
  89.    5.  You are now in the Script Editor, type in the PAL code
  90.        below.
  91.  
  92.    6.  When you are finished typing in the PAL code, press <F2>
  93.        to save the script.
  94.  
  95.  ; The script begins here
  96.  
  97.      SETKEY -23 [Fieldname]=CMAX("tablename","fieldname")+1
  98.  
  99.  ; The script ends here
  100.  
  101. In your script, substitute your own field name and table name for
  102. "fieldname" and "tablename".  In the script above, any characters
  103. after the ";" including the ";" need not be entered.  They are
  104. only comments.  The SETKEY macro featured on the previous page
  105. will only function properly when you are in Edit or Coedit Mode
  106. and when the fieldname is a numeric data type.  It is designed
  107. for single user interactive use only.  For information on
  108. generating incremental values in a PAL application or in a
  109. network environment, refer to TI 662.
  110.  
  111. The PAL script above assigns the PAL code to Alt-I (where -23 is
  112. the extended code for Alt-I).  Alt-I is just one possible code
  113. that you can assign to the PAL script.  See Appendix G of the PAL
  114. Reference Guide for a list of Keycodes Recognized by Paradox (for
  115. versions earlier than 4.0, refer to Appendix B of the PAL User's
  116. Guide).
  117.  
  118. Paradox will execute the command, every time you press the
  119. assigned key (i.e. Alt-I).
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140. PRODUCT  :  Paradox                               NUMBER  :  1213
  141. VERSION  :  All
  142.      OS  :  DOS
  143.    DATE  :  January 14, 1993                         PAGE  :  3/3
  144.  
  145.   TITLE  :  Generating Incremental Values Using SETKEY
  146.  
  147.  
  148.  
  149.  
  150. For additional information on the SETKEY command, refer to the
  151. PAL Programmer's Guide and the PAL Reference Guide (for versions
  152. earlier than 4.0, refer to the PAL User's Guide).  Other methods
  153. of generating incremental values are presented in Technical
  154. Information Sheet #662.
  155.  
  156. DISCLAIMER: You have the right to use this technical information
  157. subject to the terms of the No-Nonsense License Statement that
  158. you received with the Borland product to which this information
  159. pertains.
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.